#pragma once
#include <boost/array.hpp>
#include <boost/asio.hpp>
#include <boost/thread.hpp>
#include "UltimateAsioNetworkPluginPrecompiled.h"
#include "UltimateNetworkSubsystem.h"
#include <iostream>
#include <string>


using boost::asio::ip::tcp;

class _UltimateAsioNetworkPluginExport UltimateAsioNetworkSubsystem: public UltimateNetworkSubsystem 
{
	
	std::vector<tcp::socket*> sockets;
	std::map<int,EntityNetworkRecord> entityRecordMap;

	void accept(int port);
	void connect(std::string ip, int port);

	void sendAndReceive();

	
	bool disconnect;



public:

	virtual void createRecordForPlayer(int id, bool server); 
	virtual void listenOnPort(int port);
	virtual void connectToServer(std::string ip, int port);
	virtual EntityNetworkRecord getRecordForPlayer(int id);
	virtual void setRecordForPlayer(int id, EntityNetworkRecord record);
	virtual void destroyConnection();




	UltimateAsioNetworkSubsystem();
    virtual ~UltimateAsioNetworkSubsystem(); 
};
